package tongcheng.com.tongcheng.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import tongcheng.com.tongcheng.ConStans;
import tongcheng.com.tongcheng.R;
import tongcheng.com.tongcheng.base.BaseViewHolder;
import tongcheng.com.tongcheng.utils.GlideApp;

/**
 * Created by P on 2017/8/1.
 */

public class ThreeImageAdapter extends RecyclerView.Adapter<ThreeImageAdapter.ThreeimageViewholder> {

    public Context mContext;
    public String[] split;
    public ThreeImageAdapter(Context context,String[] split) {
        this.mContext = context;
        this.split = split;
    }

    @Override
    public ThreeimageViewholder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view = View.inflate(mContext, R.layout.item_image, null);
        ThreeimageViewholder threeimageViewholder = new ThreeimageViewholder(view);
        return threeimageViewholder;
    }

    @Override
    public void onBindViewHolder(ThreeimageViewholder holder, int position) {
        Log.e("订单详情图片",ConStans.BaseUrl_Test_url + split[position] + "");
        GlideApp.with(mContext).load(ConStans.BaseUrl_Test_url + split[position]).into(holder.image);
    }

    @Override
    public int getItemCount() {
        return split.length;
    }

    public class ThreeimageViewholder extends BaseViewHolder{

        public ImageView image;

        public ThreeimageViewholder(View itemView) {
            super(itemView);
        }

        @Override
        public void init(View itemview) {
            image=  itemview.findViewById(R.id.item_image_image);
        }
    }

    public void setSplit(String[] split) {
        this.split = split;
    }
}
